import api from "./api";



export default {

    //根据桌号获取订单信息
    getCatInfo(tableid) {
        return api.post(`/api/wechatxcx/catering/order/queryCatInfo/${tableid}`).then((res) => {
            return res
        })
    },

    //根据餐厅id  获取餐厅详情
    getCatByCatId(param) {
        return api.post('/api/catering/dishes/findcatering', {data: param}).then((res) => {
            return res
        })
    },

    // 根据桌号获取餐厅信息
    getCatByTable(param) {
        return api.post('/api/catering/dishes/findcateringbytabid', {data: param}).then((res) => {
            return res
        })
    },

    //根据菜品id获取餐厅详情
    getCatDetail(param) {
        return api.post('/api/catering/dishes/findcateringbydishesid', {data: param}).then((res) => {
            return res
        })
    },

    //根据菜品id获取菜品详情
    findById(param) {
        return api.post('/api/catering/dishes/findbyid', {data: param}).then((res) => {
            return res
        })
    },

    //获取购物车订单
    getOrderDetail(param) {
        return api.post('/api/wechatxcx/catering/order/queryOrderShoppingCart', {data: param}).then((res) => {
            return res
        })
    },

    //ncr订单详情
    getNcrOrderDetail(param) {
        return api.post('/api/wechatxcx/catering/order/queryNcrOrderDetails', {data: param}).then((res) => {
            return res
        })
    },

    //获取浏览记录
    getBrowse(param) {
        return api.post('/api/wechatxcx/catering/browserecord/queryMyBrowseRecord', {data: param}).then((res) => {
            return res
        })
    },

    //删除浏览记录
    delBrowse(param) {
        return api.post('/api/wechatxcx/catering/browserecord/delete', {data: param}).then((res) => {
            return res
        })
    },

    //添加浏览记录
    addBrowse(param) {
        return api.post('/api/wechatxcx/catering/browserecord/create', {data: param}).then((res) => {
            return res
        })
    },

    //根据餐厅id,获取热销菜品
    getHotByCatId(param) {
        return api.post('/api/catering/dishes/getRecommendDishes', {data: param}).then((res) => {
            return res
        })
    },

    //根据餐厅id获取今日与明日的推荐菜
    getMealsList(param) {
        return api.post('/api/catering/recommend/queryTodayAndTomorrowRec', {data: param}).then((res) => {
            return res
        })
    },

    //保存推荐菜
    saveRecommend(param) {
        return api.post('/api/catering/myrecommend/saveAll', {data: param}).then((res) => {
            return res
        })
    },

    //获取已保存的早中晚推荐菜
    getRecomDish(param) {
        return api.post('/api/catering/myrecommend/queryMyRecommend', param).then((res) => {
            return res
        })
    },

    //显示购物车的菜品列表
    showCartDishes(param) {
        return api.post('/api/wechatxcx/catering/order/queryOrderShoppingCart', {data: param}).then((res) => {
            return res
        })
    },

    //加入菜品进购物车
    addCart(param) {
        return api.post('/api/wechatxcx/catering/order/addShoppingCart', {data: param}).then((res) => {
            return res
        })
    },

    //从购物车中删除菜品
    delCart(param) {
        return api.post('/api/wechatxcx/catering/sys/order/deleteShoppingCart', {data: param}).then((res) => {
            return res
        })
    },

    //清空购物车列表
    clearCart(param, orderId) {
        return api.post(`/api/wechatxcx/catering/order/clearOrderShoppingCart/${orderId}`, {data: param}).then((res) => {
            return res
        })
    },

    //查询相关运营组织下的餐厅
    queryNearHotels(param) {
        return api.post('/api/catering/order/queryOperateCaterings', {data: param}).then((res) => {
            return res
        })
    },

    //获取运营名称
    getOrgName(param) {
        return api.post('/api/catering/order/queryOperateCaterings', {data: param}).then((res) => {
            return res
        })
    },

    //根据id，查看菜品详情
    showMenuDetail(param) {
        return api.post('/api/catering/dishes/findbyid', {data: param}).then((res) => {
            return res
        })
    },

    //获取菜品分类列表
    getAllKind(param) {
        return api.post('/api/catering/kind/allkind', {data: param}).then((res) => {
            return res
        })
    },

    //根据体质获取菜品列表
    getDishByPhy(param) {
        return api.post('/api/catering/dishes/querybyphysique', {data: param}).then((res) => {
            return res
        })
    },

    //根据节气获取菜品列表
    getDishByTerm(param) {
        return api.post('/api/catering/dishes/querybysolarterm', {data: param}).then((res) => {
            return res
        })
    },

    //根据菜品分类id查询菜品
    getDishByKind(param) {
        return api.post('/api/catering/dishes/querybykind', param).then((res) => {
            return res
        })
    },

    // 根据餐厅查询所有菜品，带分类信息
    queryAllDishes(param) {
        return api.post('/api/catering/dishes/queryAllDishesNotMerge', param).then((res) => {
            return res
        })
    },

    // 根据餐厅查询所有菜品，带分类信息 -- 新
    queryAllDishesNew(param) {
        return api.post('/api/catering/dishes/queryAllDishesMerge', param).then((res) => {
            return res
        })
    },

    //点餐,下单
    saveOrder(param) {
        return api.post('/api/wechatxcx/catering/order/saveOrder', {data: param}).then((res) => {
            return res
        })
    },

    //获取当天的预点单
    getPreDish(param) {
        return api.post('/api/catering/beforehand/queryMybeforehand', param).then((res) => {
            return res
        })
    },

    //预点单加入购物车
    addPreTocart(param) {
        return api.post('/api/catering/beforehand/beforehandToShoppingCart', {data: param}).then((res) => {
            return res
        })
    },

    //中断支付
    stopPay(param) {
        return api.post('/api/wechatxcx/catering/order/stopPayState', {data: param}).then((res) => {
            return res
        })
    },

    //获取发票地址列表
    getInvoiceList(param) {
        return api.post('/api/invoice/list', param).then((res) => {
            return res
        })
    },

    //删除发票地址
    delInvoice(id) {
        return api.get(`/api/invoice/remove/${id}`).then((res) => {
            return res
        })
    },

    //保存发票地址
    saveInvoice(param) {
        return api.post('/api/invoice/save', {data: param}).then((res) => {
            return res
        })
    },

    //查询税号
    getDuty(param) {
        return api.post('/api/catering/orderbill/queryCompanyList', {data: param}).then((res) => {
            return res
        })
    },

    //获取附近餐厅列表
    getCartList(param) {
        return api.post('/api/catering/order/queryNearCatering', {data: param}).then((res) => {
            return res
        })
    },

    //查询我关注的餐厅
    getFollowCart(param) {
        return api.post('/api/catering/followrelation/saveFollowRelation', {data: param}).then((res) => {
            return res
        })
    },

    //获取订单详情
    getHistoryOrderDetail(param, id) {
        return api.post(`/api/wechatxcx/catering/sys/order/queryHistoryPaidRecordDetails/${id}`, {data: param}).then((res) => {
            return res
        })
    },

    //开具发票
    markInvoice(param, id) {
        return api.post(`/api/catering/orderbill/invoice/getinvoicepath/${id}`, {data: param}).then((res) => {
            return res
        })
    },

    //获取历史订单
    getHistoryList() {
        return api.post('/api/wechatxcx/catering/order/queryHistoryPaidRecord').then((res) => {
            return res
        })
    },

    //结束选择菜品，去下单
    endOrder(param) {
        return api.post('/api/wechatxcx/catering/order/endChoiceOrder', {data: param}).then((res) => {
            return res
        })
    },

    //添加备注
    addText(param) {
        return api.post('/api/wechatxcx/catering/order/updateDishesItemMachining', {data: param}).then((res) => {
            return res
        })
    },

    //删除早中晚菜品
    delRecDish(param) {
        return api.post('/api/catering/myrecommend/removeByRecitemids', {data: param}).then((res) => {
            return res
        })
    },

    //删除预点单
    delPreDish(param) {
        return api.post('/api/catering/beforehand/removeByDate', {data: param}).then((res) => {
            return res
        })
    },

    //根据名称查询菜品
    searchByName(param) {
        return api.post('/api/catering/dishes/querybyname', {data: param}).then((res) => {
            return res
        })
    },

    // 查询餐厅配送地址
    getAddress(param){
        return api.post('/api/catering/deliveryaddress/queryCateringDeliveryAddress', {data: param}).then((res) => {
            return res
        })
    },

    // 没有结束的订单
    getNotfinish(param){
        return api.post('/api/catering/ordertakeout/queryMyTakeOutOrder', {data: param}).then((res) => {
            return res
        })
    },
    // 付款但没有结束的订单
    getNotEnd(param){
        return api.post('/api/catering/ordertakeout/queryPaidNotCompleteOrderList', {data: param}).then((res) => {
            return res
        })
    },

    //保存外卖订单
    saveTakeOrder(param) {
        return api.post('/api/catering/ordertakeout/saveMyTakeOutOrder', {data: param}).then((res) => {
            return res
        })
    },

    //确认下单
     sureOrder(param) {
         return api.post('/api/catering/ordertakeout/endChoiceOrder', {data: param}, true).then((res) => {
             return res
         })
     },

    // 根据orderid查询 具体外卖订单
    getTakeOutOrder(param) {
        return api.post('/api/catering/ordertakeout/loadTakeOutOrderInfo', {data: param}).then((res) => {
            return res
        })
    },

    // 用户申请退款
    cancelPayOreder(param){
        return api.post('/api/catering/ordertakeout/applyRefund', { data: param }, true).then((res) => {
            return res
        })
    },

    // 结束订单
    endTakeOutOrder(param) {
         return api.post('/api/catering/ordertakeout/userGetTakeOrder', {data: param}).then((res) => {
             return res
         })
     },
    // 取消订单
    cancelOrder(param) {
        return api.post('/api/catering/ordertakeout/cancelOrder', {data: param}).then((res) => {
            return res
        })
    },

    // 查询外卖/自提上次地址信息
    queryMyLastAddress(param) {
        return api.post('/api/catering/ordertakeout/queryMyLastAddress', { data: param }).then((res) => {
            return res
        })
    },
    // 查询下单页价格
    getAllKindPrice(param) {
        return api.post('/api/catering/ordertakeout/calTakeoutOrderSums', { data: param }).then((res) => {
            return res
        })
    },
    // 获取我的兑换券
    getMyCoupon(param) {
        return api.post('/api/catering/lpcoupon/queryMyLpcoupon', { data: param }).then((res) => {
            return res
        })
    },
    // 获取餐厅兑换券
    getCatCoupon(param) {
        return api.post('/api/catering/lpcoupon/queryCateringLpcoupon', { data: param }).then((res) => {
            return res
        })
    },
    // 查询订单中可用券
    queryUsableAccount(param) {
        return api.post('/api/catering/publicorder/queryUsableAccount', { data: param }).then((res) => {
            return res
        })
    },
    // 计算券与订单的金额
    queryUseAccount(param) {
        return api.post('/api/catering/publicorder/useAccount', { data: param }).then((res) => {
            return res
        })
    },
    //查询已完成的订单
    getCompleteOrder(options) {
        return api.post('/api/catering/publicorder/queryCompleteOrder', options).then((res) => {
            return res
        })
    },
    //查询待付款订单
    getPendingPaymentOrder(options) {
        return api.post('/api/catering/publicorder/queryPendingPaymentOrder', options).then((res) => {
            return res
        })
    },
    //查询待收货订单
    getCanUseOrder(options) {
        return api.post('/api/catering/publicorder/queryCanUseOrder', options).then((res) => {
            return res
        })
    },

    //查询全部订单
    getMyAllOrder(options) {
        return api.post('/api/catering/publicorder/queryMyAllOrder', options).then((res) => {
            return res
        })
    },

    // 兑换券订单预保存接口
    useAccountNotSaveOrder(param) {
        return api.post('/api/catering/publicorder/useAccountNotSaveOrder', { data: param }).then((res) => {
            return res
        })
    },

    // 获取菜品套餐
    getJardiniere(param) {
        return api.post('/api/catering/dishes/queryJardiniere', param).then((res) => {
            return res
        })
    },


}




